
TARGET=demo
SRC=main.c
OBJS=main.o ../lib/serial.o
CC=$(CROSS_COMPILE)gcc

ifeq ($(coverage), yes)
	CFLAGS = -g -Wall -fprofile-arcs -ftest-coverage
	CXXFLAGS = -g -Wall -DLINUX -DGTEST -fprofile-arcs -ftest-coverage
	LDFLAGS = -lgcov
endif
CFLAGS = -I ../lib

.PHONY:$(TARGET) cc_result clean
$(TARGET):$(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS) -static

cc_result:
	./$(TARGET)
	gcov $(SRC)
	lcov -c -d ./ -o app.info
	genhtml app.info -o $@
clean:
	rm -rf $(TARGET) $(OBJS) *.gcno *.gcda *.info *.gcov cc_result
install:
	install ${TARGET} /nfs/serial_test
